
package it.bd.SetAllConnectionsOff;

import android.app.PendingIntent;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.widget.RemoteViews;

public class SetAllConnectionsOffWidget extends AppWidgetProvider {

    @Override
    public void onEnabled(Context context) {
        super.onEnabled(context);
        WidgetActivity.fixIcon(context);
    }

    @Override
    public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
        WidgetActivity.fixIcon(context);
        RemoteViews updateViews = new RemoteViews(context.getPackageName(), R.layout.widget);
        Intent defineIntent2 = new Intent(context, WidgetActivity.class);
        PendingIntent pendingIntent2 = PendingIntent.getActivity(context, 0, defineIntent2, 0);
        updateViews.setOnClickPendingIntent(R.id.widget, pendingIntent2);

        if (updateViews != null) {
            ComponentName thisWidget = new ComponentName(context, SetAllConnectionsOffWidget.class);
            if (thisWidget != null) {
                AppWidgetManager manager = AppWidgetManager.getInstance(context);
                if (manager != null && updateViews != null) {
                    manager.updateAppWidget(thisWidget, updateViews);
                }
            }
        }
    }
}
